//
//  GZHeaderImageTableViewCell.m
//  B段项目
//
//  Created by 高哲 on 15/11/4.
//  Copyright © 2015年 谢美娜. All rights reserved.
//

#import "GZHeaderImageTableViewCell.h"
#import "Header.h"

@implementation GZHeaderImageTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _photoImageView = [[UIImageView alloc] init];
        _photoImageView.layer.cornerRadius = 8.0;
        _photoImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:_photoImageView];
        
        _NewImageView = [[UIImageView alloc] init];
        _NewImageView.layer.cornerRadius = 8.0;
        _NewImageView.layer.masksToBounds = YES;
        [_photoImageView addSubview:_NewImageView];
        
        _titleLabel = [[myTitleLabel alloc] init];
        _titleLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_titleLabel];
        
        _playImageView = [[UIImageView alloc] init];
        _playImageView.image = [UIImage imageNamed:@"GZbofang.png"];
        [self.contentView addSubview:_playImageView];
        
        _iconimageView = [[UIImageView alloc] init];
        _iconimageView.image = [UIImage imageNamed:@"GZguangbo.png"];
        [self.contentView addSubview:_iconimageView];
        
        _peopleLabel = [[UILabel alloc] init];
        _peopleLabel.textColor = [UIColor lightGrayColor];
        _peopleLabel.font = [UIFont systemFontOfSize:12];
        _peopleLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_peopleLabel];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _photoImageView.frame = CGRectMake(20 * FitWidth, 15 * FitHeight, 70 * FitWidth, 70 * FitHeight);
    _NewImageView.frame = CGRectMake(0, 0, 30 * FitWidth, 30 * FitHeight);
    _titleLabel.frame = CGRectMake(_photoImageView.frame.size.width + _photoImageView.frame.origin.x + 10 * FitWidth, _photoImageView.frame.origin.y, 210 * FitWidth, 30 * FitHeight);
    _playImageView.frame = CGRectMake(320 * FitWidth, self.contentView.frame.size.height / 2 - 13 * FitHeight, 26 * FitWidth, 26 * FitHeight);
    _iconimageView.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.size.height + _titleLabel.frame.origin.y + 10 * FitHeight, 20 * FitWidth, 20 * FitHeight);
    _peopleLabel.frame = CGRectMake(_iconimageView.frame.origin.x + _iconimageView.frame.size.width + 5 * FitWidth, _iconimageView.frame.origin.y + 3 * FitHeight, 150 * FitWidth, 20 * FitHeight);
}

- (void)setRadioModel:(GZ_RadioModel *)radioModel
{
    _titleLabel.text = [[radioModel valueForKey:@"playInfo"] valueForKey:@"title"];
    if (radioModel.isnew == true) {
        _NewImageView.image = [UIImage imageNamed:@"GZnew.png"];
    }
    [_photoImageView sd_setImageWithURL:[NSURL URLWithString:radioModel.coverimg] placeholderImage:[UIImage imageNamed:@"GZzhanwei.png"]];
    _peopleLabel.text = radioModel.musicVisit;
}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
